import App from './App'
import store from './store'
import { getDict } from '@/utils/dict'
import { formatDict, transformDict } from '@/utils/utils'
import uView from '@/uni_modules/uview-ui'
import NP from '@/utils/numberPrecision'
import i18nConfig from './locale/index'
import privacyPreview from '@/utils/privacy'
// NP.strip(num)         // strip a number to nearest right number
// NP.plus(num1, num2, num3, ...)   // addition, num + num2 + num3, two numbers is required at least.
// NP.minus(num1, num2, num3, ...)  // subtraction, num1 - num2 - num3
// NP.times(num1, num2, num3, ...)  // multiplication, num1 * num2 * num3
// NP.divide(num1, num2, num3, ...) // division, num1 / num2 / num3
// NP.round(num, ratio)  // round a number based on ratio

// #ifndef VUE3
import Vue from 'vue'
import VueI18n from 'vue-i18n'
Vue.config.productionTip = false
Vue.prototype.$getDict = getDict
Vue.prototype.$formatDict = formatDict
Vue.prototype.$transformDict = transformDict
Vue.prototype.$NP = NP
Vue.prototype.$privacy = privacyPreview

App.mpType = 'app'
Vue.use(VueI18n)
Vue.use(uView)
const i18n = new VueI18n(i18nConfig)
const app = new Vue({
  i18n,
  ...App,
  store
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
Vue.prototype.$getDict = getDict
Vue.prototype.$formatDict = formatDict
Vue.prototype.$transformDict = transformDict
Vue.prototype.$NP = NP

export function createApp() {
  const app = createSSRApp(App)
  app.use(store)
  return {
    app
  }
}
// #endif
